<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title></title>
	<link rel="stylesheet" href="css/login.css">
	<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.css">

</head>
<body>
	<div class="container">
	    <div class="row" style="margin-top: 350px">
	        <div class="col-sm-6 position">
	        	<div class="form-top">
	        		<div class="form-top-left">
	        			<h3>登录乐淘后台管理系统</h3>
	            		<p>请输入您的用户名和密码</p>
	        		</div>
	        		<div class="form-top-right">
	        			<i class="fa fa-key"></i>
	        		</div>
	            </div>
	            <div class="form-bottom">
	                <form role="form" action="" method="post" class="login-form">
	                	<div class="form-group">
	                    	<input type="text" placeholder="用户名..." class="form-username form-control username">
	                    </div>
	                    <div class="form-group">
	                    	<input type="password" placeholder="密码..." class="form-password form-control password">
	                    </div>
	                    <button type="button" class="btn btn-primary loginbtn">登录</button>
	                </form>
	            </div>
	        </div>
	    </div>
	</div>
</body>
<script src="lib/jquery/jquery.js"></script>
<script>
	$(function () {


		$('.loginbtn').click(function () {
			var username = $('.username').val();
			var password = $('.password').val();
			console.log(username,password);
			var obj = {
				username:username,
				password:password,
			}
			$.ajax({
				type:'post',
				url:'http://127.0.0.1:3002/checkLogin',
				dataType:"json",
				data:JSON.stringify(obj),
				async: true,
				success:function (data) {
					//console.log(data);
					if(data.status == 0){
						location.href = '/'
					}else{
						alert('您的网络抽风了');
					}
				}
			})
		})
	})
</script>
</html>